const mongoose = require('mongoose');

const energyDataSchema = new mongoose.Schema({
  deviceId: { type: String, required: true },
  type: { type: String, enum: ['electricity', 'water', 'gas'], required: true },
  consumption: { type: Number, required: true },
  cost: Number,
  timestamp: { type: Date, default: Date.now },
  building: String,
  floor: String
}, { timestamps: true });

module.exports = mongoose.model('EnergyData', energyDataSchema);